From: Jasper St. Pierre Date: Fri, 11 Nov 2011 04:57:39 +0000 (-0500) Subject: browser-plugin: Use g_strndup to get a string property X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7308 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9bc1a68fe48a0b1e8f377597387baea7a90a3a5b;p=gnome-shell.git browser-plugin: Use g_strndup to get a string property WebKit-based browsers like Chromium and Epiphany may insert extra junk at the end of NPStrings, so we cannot depend on the strlen matching. https://bugzilla.gnome.org/show_bug.cgi?id=663823 --- diff --git a/browser-plugin/browser-plugin.c b/browser-plugin/browser-plugin.c index 2daa0ddcd..b71788939 100644 --- a/browser-plugin/browser-plugin.c +++ b/browser-plugin/browser-plugin.c @@ -71,10 +71,7 @@ get_string_property (NPP instance, goto out; result_str = NPVARIANT_TO_STRING (result); - if (strlen (result_str.UTF8Characters) != result_str.UTF8Length) - goto out; - - result_copy = g_strdup (result_str.UTF8Characters); + result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length); out: funcs.releasevariantvalue (&result);